package com.cyt.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.cyt.dao.impl.SPFeiLeiDaoImpl;
import com.cyt.dao.impl.ShangPingXXDaoImpl;
import com.cyt.dao.impl.ShangPingXXTwoDaoImpl;
import com.cyt.dao.impl.XingWengXiZhiDaoImpl;
import com.cyt.entity.SPFeiLei;
import com.cyt.entity.ShangPingXX;

// 产品的分类  产品详细
public class ProductDetallServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session =request.getSession();

		
		SPFeiLeiDaoImpl sDao= new SPFeiLeiDaoImpl();//创建对象
	    List <SPFeiLei> list=sDao.getSPFeiLei();//调用方法获得用户集合
	   request.setAttribute("sp", list);//将数据存入request中
	 //商品上面的单个显示分类
	   int cPFLId =Integer.parseInt(request.getParameter("categoryId"));
	   SPFeiLeiDaoImpl slDao= new SPFeiLeiDaoImpl();//创建对象
	    List <SPFeiLei> spFLlist=slDao.getSPFeiLeiTwo(cPFLId);//调用方法获得用户集合
	   request.setAttribute("spl", spFLlist);//将数据存入request中
	   //商品详情
	   int cid =Integer.parseInt(request.getParameter("categoryId"));
	   ShangPingXXTwoDaoImpl spTDao=new ShangPingXXTwoDaoImpl();
	   List <ShangPingXX> sPList =  spTDao.getShangPingXXTwo(cid);
	   request.setAttribute("ShangTwo", sPList);//将数据存入request中
	   session.setAttribute("ShangTwo", sPList);

	   
	   
	   request.getRequestDispatcher("productdetails.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
